﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThaireInvestmentWeb.WcfSerivce;

namespace ThaireInvestmentWeb.Models
{
    public class LoansHeaderAdapter
    {
        private LoansHeader Header { get; set; }
        public LoansHeaderAdapter(LoansHeader header)
        {
            Header = header;
        }

        public virtual int LoansHeaderID { get { return Header.LoansHeaderID; } }

        public virtual String CompanyName
        {
            get
            {
                return Header.CompanyName;
            }
        }
        public virtual String LoanTypeName
        {
            get
            {
                return Header.LoanTypeName;
            }
        }
        public virtual String Status
        {
            get
            {
                //If Alive then Pending else closed
                var status = string.Empty;

                if (Header.MaturityStatus != null && Header.MaturityStatus.ToLower() == "alive")
                    status = "Pending";
                if (Header.MaturityStatus != null && Header.MaturityStatus.ToLower() == "matured")
                    status = "Closed";

                return status;
            }
        }
        public virtual String ContractNumber
        {
            get
            {
                return Header.ContractNumber;
            }
        }
        public virtual String BorrowerName
        {
            get
            {
                return Header.BorrowerName;
            }
        }
        public virtual String GuarantorName
        {
            get
            {
                return Header.GuarantorName;
            }
        }
        public virtual DateTime? ContractStartDate
        {
            get
            {
                return Header.ContractStartDate;
            }
        }
        public virtual DateTime? ContractEndDate
        {
            get
            {
                return Header.ContractEndDate;
            }
        }
        public virtual decimal? ContractAmount
        {
            get
            {
                return Header.ContractAmount;
            }
        }

    }
}